package ui;

import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

public class MainInput implements MouseListener, KeyListener {

	Point mousePosition = new Point(0, 0);
	
	public boolean mouseButtonPressed[] = new boolean[3];
	private boolean mouseButtonClicked[] = new boolean[3];
	
	public MainInput() {
	}
	
	// Funktion wird in der Hauptschleife aufgerufen
	public void logic(MainPanel panel) {
		mousePosition = panel.getMousePosition();
	}
	
	public void draw(Graphics2D g2d) {
	}
	
	// Get Funktionen
	public boolean getMouseClicked(int button) {
		boolean tmp = mouseButtonClicked[button];
		mouseButtonClicked[button] = false;
		return tmp;
	}
	
	public boolean getMousePressed(int button) {
		return mouseButtonPressed[button];
	}

	@Override
	public void keyPressed(KeyEvent e) {
	}

	@Override
	public void keyReleased(KeyEvent e) {
	}

	@Override
	public void keyTyped(KeyEvent e) {
	}

	@Override
	public void mouseClicked(MouseEvent e) {
	}

	@Override
	public void mouseEntered(MouseEvent e) {
	}

	@Override
	public void mouseExited(MouseEvent e) {
	}

	@Override
	public void mousePressed(MouseEvent e) {
		mouseButtonPressed[e.getButton()-1] = true;
		mouseButtonClicked[e.getButton()-1] = true;
	}

	@Override
	public void mouseReleased(MouseEvent e) {
		mouseButtonPressed[e.getButton()-1] = false;
	}

}
